#!/bin/sh

set -e

. $CETIC_6LBR_CONF
. $1/6lbr-functions

config_default

MODE_6LBR=$2
DEV=$3
OS=`uname`

if [ $MODE_6LBR != "tap" ]; then
	exit
fi

if [ "$BRIDGE" != 1 ]; then
	exit
fi

if [ "$BRIDGE_DISABLE_SNOOPING" != "1" ]; then
	exit
fi

case $OS in
	Linux)
			if [ -e /sys/devices/virtual/net/$DEV_BRIDGE/bridge/multicast_snooping ]; then
				echo 0 > /sys/devices/virtual/net/$DEV_BRIDGE/bridge/multicast_snooping
			fi
		;;

	Darwin)
		;;

	*)
		echo Unknown OS
		;;
esac
